#-*- encoding:utf8 -*-
from tools import tools
from django.template.loader import Context

class Searcher(object):
    def __init__(self,name,title,model):
        self.name = name
        self.title = title
        self.model = model

    def get_template(self):
        path = self.model.school_get_model_full_name()
        return tools.Import.get_field_template(path,u'actions/%s.html'%self.name,u'base/actions/%s.html'%self.name)

    def get_context(self):
        return Context({
            u'name' : self.name,
            u'model' : self.model
        })

    def render(self):
        try:
            return self.get_template().render(self.get_context())
        except:
            return ''